﻿@model DogsClub.WebUI.Models.User
@{
    Layout = "~/Views/Shared/_Layout2.cshtml";
}
@{
    List<SelectListItem> sexDog = new List<SelectListItem>();
    if (ViewData["sexDog"] != null)
    {
        var a = ViewData["sexDog"] as IEnumerable<DogsClub.WebUI.Models.SexDog>;
        if (a != null)
        {
            sexDog.AddRange(a.Select(t => new SelectListItem() { Text = t.Name, Value = t.Id.ToString(), Selected = t.Id.ToString() != Model.GetSex ? false : true }));
        }
    }
}
<link href="~/DatePicker/jquery-ui-DatePicker.css" rel="stylesheet" />
<div class="PersonInfo">
    <h3>Личные данные</h3>
    @ViewData["UserEmail"]
    <div id="ContPhoto">
        <div class="ImageUser">
            <div id="AvatarPersonal">
                <div>
                    <img src="@Url.Action("GetAvatar", "Images", new { NameUser = Model.Email })" width="120" height="130" />
                </div>
            </div>
        </div>
        <div id="chengefile">
            @using (Html.BeginForm("GetAvatar", "Images", FormMethod.Post, new { enctype = "multipart/form-data", @class = "NewForm" }))
            {
                @Html.Hidden("NameUser", Model.Email)
                <input type="file" name="file" />
                <input id="submitChenge" type="submit" value="Изменить" />
            }
        </div>

    </div>
    @using (Html.BeginForm("Edit", "User", FormMethod.Post, new { @class = "FormEditUsers" }))
    {
        @Html.AntiForgeryToken()
    
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    @Html.HiddenFor(model => Model.Id)
        <div class="DataauthorizationUser">

            <div class="NamePersonCb">Фамилия</div>
            @Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "ValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })

            <div class="NamePersonCb">Имя</div>
            @Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "ValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })

            <div class="NamePersonCb">Отчество</div>
            @Html.EditorFor(model => model.MiddleName, new { htmlAttributes = new { @class = "ValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.MiddleName, "", new { @class = "text-danger" })


            <div class="NamePersonCb">Пол</div>
            @Html.DropDownList("GetSexDog", sexDog, new { @class = "ValuePersonCab newDropDown" })

                <div class="NamePersonCb">Дата Рождения</div>
            <input type="text" value="@Model.BirthDate.ToShortDateString()" name="BirthDate" id="BirthDate" class="ValuePersonCab" />
                   @*@Html.EditorFor(model => model.BirthDate., new { htmlAttributes = new { @class = "ValuePersonCab" } })*@
                   @Html.ValidationMessageFor(model => model.BirthDate, "", new { @class = "text-danger" })</div>
        <div class="newConteinerImagesUser">


            <div class="NamePersonCab ">Email</div>
            @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
            <div class="NamePersonCab">Пароль</div>

            @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
            <div class="NamePersonCab">Дата регистрации</div>
            @Html.EditorFor(model => model.RegistrationDate, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.RegistrationDate, "", new { @class = "text-danger" })
        </div>
        <div class="newConteinerImagesUser">
            <div class="NamePersonCab">Телефон</div>
            @Html.EditorFor(model => model.Phone, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.Phone, "", new { @class = "text-danger" })

            <div class="NamePersonCab">Город</div>
            @Html.EditorFor(model => model.City, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.City, "", new { @class = "text-danger" })

            <div class="NamePersonCab">Адрес</div>
            @Html.EditorFor(model => model.Address, new { htmlAttributes = new { @class = "newValuePersonCab" } })
            @Html.ValidationMessageFor(model => model.Address, "", new { @class = "text-danger" })

        </div>
        <input type="submit" value="Сохранить" class="btn btn-info" id="newSubmit" />
    }
</div>
@section script{
    <script src="~/DatePicker/DataPicker(1-10).js"></script>
    <script src="~/DatePicker/DataPicker(1-11).js"></script>
    <script src="~/DatePicker/MyScriptDatePicker.js"></script>

    @*<script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>*@
    <script>
        $('#BirthDate').datepicker({
            dateFormat: 'dd.mm.yy'
        });
        $(function () {
            $("#BirthDate").datepicker();
        });
        $('#datepicker').datepicker('option', $.datepicker.regional["ru"]);

        jQuery(function ($) {
            $.datepicker.regional['ru'] = {
                monthNames: ['Яварь', 'Февраль', 'Март', 'Апрель',
                'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь',
                'Октябрь', 'Ноябрь', 'Декабрь'],
                dayNamesMin: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
                firstDay: 1,
            };
            $.datepicker.setDefaults($.datepicker.regional['ru']);
        });
        $.datepicker.setDefaults($.extend(
          $.datepicker.regional["ru"])
        );
    </script>

}
